package com.crm.system.service.impl.returnMoney;

import com.crm.common.model.DhPageInfo;
import com.crm.model.vo.returnMoney.ReturnMoneyLogVO;
import com.crm.service.returnMoney.ReturnMoneyLogDbService;
import com.crm.system.service.returnMoney.ReturnMoneyLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: chaifuyou
 * @date 2021/3/30 9:16
 */
@Service
public class ReturnMoneyLogServiceImpl implements ReturnMoneyLogService {
    @Autowired
    private ReturnMoneyLogDbService returnMoneyLogDbService;

    /**
     * 根据订单id修改回款日志
     * @param orderId
     * @return
     */
    @Override
    public DhPageInfo<ReturnMoneyLogVO> getReturnMoneyLogList(String orderId,Integer pageIndex,Integer pageSize) {
        if (pageIndex != null && pageSize != null) {
            PageHelper.startPage(pageIndex, pageSize);
        }
        List<ReturnMoneyLogVO> logs=returnMoneyLogDbService.getReturnMoneyLogList(orderId);
        PageInfo<ReturnMoneyLogVO> page =new PageInfo<>(logs);
        return new DhPageInfo<ReturnMoneyLogVO>(page, logs);
    }
}
